package pteam;

import simulator.Actor;
import simulator.BeaconSensor;
import simulator.Robot;
import simulator.Sensor;

public class BeaconActor implements Actor{
	public static final int NOBEACON = -1;
	public static final int BEACON_STRAIGHT = 0;
	public static final int BEACON_LEFT = 1;
	public static final int BEACON_RIGHT = 2; 
	public static final int DRIVEDIST = 2;
	public static final int TURNANGLE = 10;
	
	public int navState = NOBEACON;
	
	public void act(Robot s) {
		switch(navState){
			case BEACON_STRAIGHT:
				s.goForward();
				s.waitDistance(DRIVEDIST);
				break;
			case BEACON_LEFT:
				s.goForward();
				s.waitDistance(DRIVEDIST);
				s.turnLeft();
				s.waitAngle(TURNANGLE);
				break;
			case BEACON_RIGHT:
				s.goForward();
				s.waitDistance(DRIVEDIST);
				s.turnRight();
				s.waitAngle(TURNANGLE);
				break;
			default:
				return;
		}
	}

	public String getMaze() {
		return "GoldGen";
	}

	public void updateSensors(Sensor[] sensors) {
		/*if(sensors[6].getState()[0] == BeaconSensor.INBOTH){
			navState = BEACON_STRAIGHT;
		}else if(sensors[6].getState()[0] == BeaconSensor.INGREEN){
			navState = BEACON_RIGHT;
		}else if(sensors[6].getState()[0] == BeaconSensor.INRED){
			navState = BEACON_LEFT;
		}else
			navState = NOBEACON;*/
		
	}

}
